<#--Created by IntelliJ IDEA.
User: Administrator
Date: 2017/12/7
Time: 12:40
To change this template use File | Settings | File Templates.-->

<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>生产通知单</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css">
  <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
  <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.all.js" charset="utf-8"></script>
  <script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
</head>

<body>
<div class="x-body">
  <form class="layui-form layui-form-pane" id="saveForm1" style="margin-left: 20px;">
    <div class="layui-form-item">
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
        <legend style="font-size:16px;">生产通知单</legend>
      </fieldset>
    </div>
    <div class="layui-form-item">
      <label for="uname" class="layui-form-label">
        <span class="x-red">*</span>订单编号
      </label>
      <div class="layui-input-inline">
        <input type="text" id="orderNo" name="orderNo" lay-verify="orderNo"  autocomplete="off" class="layui-input">
      </div>

      <div class="layui-inline">
        <label for="noticeTime" class="layui-form-label">
          <span class="x-red">*</span>通知单下发时间
        </label>
        <div class="layui-input-inline">
        <input type="text"  id="noticeTime" name="noticeTime"  lay-verify="noticeTime"  placeholder="yyyy-MM-dd HH:mm:ss"
               autocomplete="off" class="layui-input">
        </div>
      </div>
    </div>
    <div class="layui-form-item">
    <div class="layui-inline">
      <label for="realName" class="layui-form-label">
        <span class="x-red">*</span>销售
      </label>
      <div class="layui-input-inline">
        <input type="text" id="saleName" name="saleName" lay-verify="saleName"  autocomplete="off" class="layui-input">
      </div>
    </div>
      <div class="layui-inline">
        <label for="age" class="layui-form-label">
          <span class="x-red">*</span>客户地址
        </label>
        <div class="layui-input-inline">
          <input type="text" id="customeraddress" name="customeraddress"  lay-verify="number"
                 autocomplete="off" class="layui-input">
        </div>
      </div>
      <div class="layui-inline">
        <label for="password" class="layui-form-label">
          <span class="x-red">*</span>交货日期
        </label>
        <div class="layui-input-inline">
          <input type="text"  id="deliveryDate" name="deliveryDate"  lay-verify="deliveryDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                 autocomplete="off" class="layui-input">
        </div>
      </div>
    </div>
<#--    <div class="layui-form-item">-->

<#--      <div class="layui-inline">-->
<#--        <label for="L_repass" class="layui-form-label">-->
<#--          <span class="x-red">*</span>确认密码-->
<#--        </label>-->
<#--        <div class="layui-input-inline">-->
<#--          <input type="password" id="l_repass" name="repass"  lay-verify="repass"-->
<#--                 autocomplete="off" class="layui-input">-->
<#--        </div>-->
<#--      </div>-->
<#--    </div>-->
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>样件名称
          </label>
          <div class="layui-input-inline">
            <input type="text"  name="taskDetails[0].sampleName" lay-verify="taskDetails[0].sampleName"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>材料
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[0].material" lay-verify="taskDetails[0].material"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>打印方式
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[0].printing" lay-verify="taskDetails[0].printing"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>数量
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[0].quantity" lay-verify="taskDetails[0].quantity"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>要求
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[0].requirement" lay-verify="taskDetails[0].requirement"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>备注
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[0].remark" lay-verify="taskDetails[0].remark"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>样件名称
          </label>
          <div class="layui-input-inline">
            <input type="text"  name="taskDetails[1].sampleName" lay-verify="taskDetails[1].sampleName"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>材料
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[1].material" lay-verify="taskDetails[1].material"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>打印方式
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[1].printing" lay-verify="taskDetails[1].printing"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>数量
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[1].quantity" lay-verify="taskDetails[1].quantity"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>要求
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[1].requirement" lay-verify="taskDetails[1].requirement"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>备注
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[1].remark" lay-verify="taskDetails[1].remark"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>样件名称
          </label>
          <div class="layui-input-inline">
            <input type="text"  name="taskDetails[2].sampleName" lay-verify="taskDetails[2].sampleName"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>材料
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[2].material" lay-verify="taskDetails[2].material"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>打印方式
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[2].printing" lay-verify="taskDetails[2].printing"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>数量
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[2].quantity" lay-verify="taskDetails[2].quantity"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>要求
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[2].requirement" lay-verify="taskDetails[2].requirement"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>备注
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[2].remark" lay-verify="taskDetails[2].remark"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>样件名称
          </label>
          <div class="layui-input-inline">
            <input type="text"  name="taskDetails[3].sampleName" lay-verify="taskDetails[3].sampleName"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>材料
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[3].material" lay-verify="taskDetails[3].material"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>打印方式
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[3].printing" lay-verify="taskDetails[3].printing"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>数量
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[3].quantity" lay-verify="taskDetails[3].quantity"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>要求
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[3].requirement" lay-verify="taskDetails[3].requirement"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>备注
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  name="taskDetails[3].remark" lay-verify="taskDetails[3].remark"  autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>结构/支撑设计
          </label>
          <div class="layui-input-inline">
            <input type="text" id="structureDept" name="structureDept" lay-verify="structureDept"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>开始时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="structureBeginDate" name="structureBeginDate"  lay-verify="structureBeginDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>结束时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="structureEndDate" name="structureEndDate"  lay-verify="structureEndDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>设备
          </label>
          <div class="layui-input-inline">
            <input type="text" id="equipmentDept" name="equipmentDept" lay-verify="equipmentDept"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>开始时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="equipmentBeginDate" name="equipmentBeginDate"  lay-verify="equipmentBeginDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>结束时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="equipmentEndDate" name="equipmentEndDate"  lay-verify="equipmentEndDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>后处理
          </label>
          <div class="layui-input-inline">
            <input type="text" id="treatmentDept" name="treatmentDept" lay-verify="treatmentDept"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>开始时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="treatmentBeginDate" name="treatmentBeginDate"  lay-verify="treatmentBeginDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>结束时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="treatmentEndDate" name="treatmentEndDate"  lay-verify="treatmentEndDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>质检
          </label>
          <div class="layui-input-inline">
            <input type="text" id="qualityDept" name="qualityDept" lay-verify="qualityDept"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>开始时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="qualityBeginDate" name="qualityBeginDate"  lay-verify="qualityBeginDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>结束时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="qualityEndDate" name="qualityEndDate"  lay-verify="qualityEndDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-inline">
          <label for="realName" class="layui-form-label">
            <span class="x-red">*</span>发货人
          </label>
          <div class="layui-input-inline">
            <input type="text" id="deliverGoodsDept" name="deliverGoodsDept" lay-verify="deliverGoodsDept"  autocomplete="off" class="layui-input">
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>开始时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="deliverGoodsBeginDate" name="deliverGoodsBeginDate"  lay-verify="deliverGoodsBeginDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
        <div class="layui-inline">
          <label for="age" class="layui-form-label">
            <span class="x-red">*</span>结束时间
          </label>
          <div class="layui-input-inline">
            <div class="layui-input-inline">
              <input type="text"  id="deliverGoodsEndDate" name="deliverGoodsEndDate"  lay-verify="deliverGoodsEndDate"  placeholder="yyyy-MM-dd HH:mm:ss"
                     autocomplete="off" class="layui-input">
            </div>
          </div>
        </div>
      </div>
    <div>
<#--      <label for="email" class="layui-form-label">-->
<#--        <span class="x-red"></span>结构/支撑设计-->
<#--      </label>-->
<#--      <div class="layui-input-block">-->
<#--        <input type="email" id="email" style="width: 93%" name="email"  lay-verify="email"-->
<#--               autocomplete="off" class="layui-input">-->
<#--        <input id="photo" name="photo" type="hidden">-->
<#--      </div>-->
    </div>
      <div class="layui-form-item">
        <label class="layui-form-label">客户反馈</label>
        <div class="layui-input-inline">
          <input type="text" id="feedback" name="feedback"  lay-verify="feedback"
                 autocomplete="off" class="layui-input">
        </div>
      </div>
      <div style="height: 60px"></div>
    </div>
  <div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;
  position: fixed;bottom: 1px;margin-left:-20px;">
    <div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">

      <button  class="layui-btn layui-btn-normal" onclick="sub1()">
        增加
      </button>
      <button  class="layui-btn layui-btn-primary" id="close">
        取消
      </button>
    </div>
  </div>
  </form>
</div>
<script>
  var flag,msg;
  console.info(flag);
  $(function(){
      $('#uname').on("blur",function(){
        var uname=$('#uname').val();
        if(uname.match(/[\u4e00-\u9fa5]/)){
          return;
        }
        if(!/(.+){3,12}$/.test(uname)){
          return;
        }
        if(uname!='') {
          $.ajax({
            url: 'checkUser?uname=' + uname, async: false, type: 'get', success: function (data) {
              console.info(!data.flag);
              flag = data.flag;
              $('#ms').find('span').remove();
              if (!data.flag) {
                msg = data.msg;
                $('#ms').append("<span style='color: red;'>"+data.msg+"</span>");
               // layer.msg(msg,{icon: 5,anim: 6});
              }else{
                flag=true;
                $('#ms').append("<span style='color: green;'>用户名可用</span>");
              }
            },beforeSend:function(){
              $('#ms').find('span').remove();
              $('#ms').append("<span>验证ing</span>");
            }
          });
        }
      });

  });
  function sub1() {
    var dataFrom = serializeRemoveNull($("#saveForm1").serialize());
    $.ajax({
      url: "addProduct",
      type: "post",
      data:dataFrom,
      success: function (data) {
        window.top.layer.msg("保存成功", {icon: 6, offset: 'rb', area: ['120px', '80px'], anim: 2});
        window.parent.location.reload();//刷新父页面
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);
      },
      error: function () {
        alert("保存失败");
      }
    })
  }
  function serializeRemoveNull(serStr){
    return serStr.split("&").filter(str => !str.endsWith("=")).join("&");
  }
  layui.use(['form','layer','upload','laydate'], function(){
    $ = layui.jquery;
    var form = layui.form
        ,layer = layui.layer,
        upload = layui.upload, laydate = layui.laydate;

    upload.render({
      elem: '#test10'
      ,url: 'upload'
      ,before: function(obj){
        //预读，不支持ie8
        obj.preview(function(index, file, result){
          $('#demo2').find('img').remove();
          $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" width="100px" height="100px" class="layui-upload-img layui-circle">');
        });
      },done: function(res){
       if(!res.flag){
         layer.msg(res.msg,{icon: 5,anim: 6});
       }else{
         $("#photo").val(res.msg);
         console.info($('#photo').val());
       }
      }
    });

    var d = new Date();
    var day=d.getFullYear()+"-"+(parseInt(d.getMonth())+1)+'-'+d.getDate();
    console.log(day);
    var $ = layui.$, active = {
      close: function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
      }
    }
    $('.layui-form-item .layui-btn').on('click', function () {
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
    var a = laydate.render({
      elem: '#noticeTime',
            trigger: 'click',
      // '#structureBeginDate','#deliveryDate','#structureEndDate','#equipmentBeginDate','#equipmentEndDate','#treatmentBeginDate','#treatmentEndDate','#qualityBeginDate',
      min:day,
      done: function(value, date, endDate) {
        b.config.min = {
          year: date.year,
          month: date.month - 1,
          date: date.date,
          hours: date.hours,
          minutes: date.minutes,
          seconds: date.seconds
        }
      }
    });
    laydate.render({
      elem: '#deliveryDate'
      ,trigger: 'click'
      // ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#structureBeginDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#structureEndDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#equipmentBeginDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#equipmentEndDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#treatmentBeginDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#treatmentEndDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#qualityBeginDate'
      ,trigger: 'click'
      // ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#qualityEndDate'
      ,trigger: 'click'
      //  ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#deliverGoodsBeginDate'
      ,trigger: 'click'
      // ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    laydate.render({
      elem: '#deliverGoodsEndDate'
      ,trigger: 'click'
      // ,format: 'yyyy年MM月dd日'
      ,type: 'datetime'
    });
    //自定义验证规则
    // form.verify({
    //   username: function(value){
    //     if(value.trim()==""){
    //       return "用户名不能为空";
    //     }
    //     if(value.match(/[\u4e00-\u9fa5]/)){
    //       return "用户名不能为中文";
    //     }
    //     if(!/(.+){3,12}$/.test(value)){
    //       return "用户名必须3到12位";
    //     }
    //     if(typeof(flag)=='undefined'){
    //       return "用户名验证ing";
    //     }
    //     if(!flag){
    //       return msg;
    //     }
    //   }
    //   ,password: [/(.+){6,12}$/, '密码必须6到12位']
    //   ,repass: function(value){
    //     if($('#password').val()!=$('#l_repass').val()){
    //       return '两次密码不一致';
    //     }
    //   }
    //   ,email:function(value){
    //     if(value!=""){
    //       if(!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/.test(value)){
    //         return "邮箱格式不正确";
    //       }
    //     }
    //   }
    // });

   $('#close').click(function(){
     var index = parent.layer.getFrameIndex(window.name);
     parent.layer.close(index);
   });
    form.on('submit(add)', function(data){
      $.ajax({
        url:'addProduct',
        type:'post',
        dataType: "json",
        data:data.field,
        async:false, traditional: true,
        success:function(d){
          var index = parent.layer.getFrameIndex(window.name);
          if(d.flag){
            parent.layer.close(index);
            window.parent.layui.table.reload('leaveList');
            window.top.layer.msg(d.msg,{icon:6,offset: 'rb',area:['120px','80px'],anim:2});
          }else{
            layer.msg(d.msg,{icon:5});
          }
        },error:function(){
          layer.alert("请求失败", {icon: 6},function () {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
          });
        }
      });
      return false;
    });
    form.render();
  });
</script>
</body>

</html>
